import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Home-pc
 * Date: 2023-10-19
 * Time: 20:54
 */
@WebServlet("/parameter1")
public class ParameterServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 约定, 客户端使用 query string 传递数据.
        // query string 形如: username=zhangsan&password=123
        String user_name=req.getParameter("username");
        String pass_word=req.getParameter("password");
        System.out.println("username"+":"+user_name);
        System.out.println("password"+":"+pass_word);
        resp.getWriter().write("ok");
    }
}
